<div class="admin_table">
<h1>DashBoard</h1>
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'restaurant-form',
)); ?>

	<div class="row_wrap">
		<div class="row column1 start_date">
			<?php echo CHtml::label('Start Date',false); ?>
			<?php if(isset($_POST['start_date'])) 
					$date = $_POST['start_date']; 
				  else 
				  	$date = date('Y-m-d'); 
			?>
			<?php echo CHtml::textField('start_date',$date,array("id"=>"start_date")); ?>
			<?php $this->widget('application.extensions.calendar.SCalendar',
        			array(
        				'inputField'=>'start_date',
        				'ifFormat'=>'%Y-%m-%d',
    				));
		    ?>	
		</div>
	
		<div class="row column2 end_date">
			<?php echo CHtml::label('End Date',false); ?>
			<?php if(isset($_POST['end_date'])) 
					$date = $_POST['end_date']; 
				  else 
				  	$date = date('Y-m-d'); 
			?>
			<?php echo CHtml::textField('end_date',$date,array("id"=>"end_date")); ?>
			<?php $this->widget('application.extensions.calendar.SCalendar',
        			array(
        				'inputField'=>'end_date',
        				'ifFormat'=>'%Y-%m-%d',
    				));
		    ?>	
		</div>
	</div>
	<div class="buttons">
		<?php echo CHtml::submitButton('Submit',array('name'=>'submit')); ?>
	</div>
	<br/>
	<?php 
	if($count_incoming == 0 && $count_successful == 0 && $count_incomplete == 0 && $count_cancelled == 0)
		echo "No Records Found"; 
	else
	{				?>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = new google.visualization.DataTable();
        data.addColumn('string', 'Task');
        data.addColumn('number', 'Hours per Day');
        data.addRows([
          ['Incoming Orders', <?php echo $count_incoming; ?>],
          ['Successful orders', <?php echo $count_successful; ?>],
          ['Incomplete Orders', <?php echo $count_incomplete; ?>],
          ['Cancelled Orders', <?php echo $count_cancelled; ?>],
        ]);

        var options = {
          width: 550, height: 400,
          title: 'Order Details'
        };

        var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>

<div id="chart_div"></div>
<?php }$this->endWidget(); ?>
</div>